<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFieldsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create ('fields', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->uuid ('id')->primary ('id');//uuid主键
            $table->string ('field_name', 30);//字段名称
            $table->string ('table_name', 50);//所属表名
            $table->string ('field_title', 50);//字段中文名
            $table->string ('tab_cate', 50);//分类tab，基本信息、扩展信息
            $table->string ('field_cate', 50);//分类显示名称
            $table->string ('field_assign', 10);//分类位置，左、右
            $table->tinyInteger ('is_hidden');//是否隐藏字段
            $table->tinyInteger ('is_create');//是否允许新增
            $table->tinyInteger ('is_edit');//是否允许修改
            $table->tinyInteger ('is_view');//是否允许查看
            $table->tinyInteger ('is_search');//是否为查询条件
            $table->tinyInteger ('is_require');//是否必填
            $table->tinyInteger ('field_type');//字段类型
            $table->tinyInteger ('field_ui_type');//视图显示类型
            $table->integer ('max_length');//字段最大长度
            $table->string ('default_value', 50);//字段默认值
            $table->timestamps ();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists ('fields');
    }
}
